package com.sj.purchase.modules.cost.domain.imei;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;

import javax.persistence.*;
import java.util.Date;


/**
 * 描述:
 * 作者: cuijh.
 * 包名：com.sj.purchase.modules.cost.views.uniquecode
 * 日期: 2018年03月14日 17:22
 * 项目名称: purchase
 * JDK: since 1.8
 */
@Entity
@Table(name = "t_unique_codes")
public class UniqueCodes{

  @Id
  @GeneratedValue(generator = "system-uuid")
  @GenericGenerator(name = "system-uuid", strategy = "uuid")
  private String id;

  @Excel(name = "订单编号" )
  private String orderId;

  @Excel(name ="交易号" )
  private String tradesId;

  @Excel(name = "规格代码" )
  private String sku_id;

  @Excel(name = "规格名称" )
  private String sku_name;

  @Excel(name = "唯一码" )
  private String ucode;

  @Excel(name = "采购入库通知单" )
  private String inOrderNo;

  @Excel(name = "订单编号所属店铺" )
  private String shopName;

  @Excel(name = "供应商" )
  private String supplierName;

  @Excel(name = "成本价" )
  private Double costPrice;

  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  @Temporal(TemporalType.TIMESTAMP)
  private Date outStockDate;

  @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  @Temporal(TemporalType.TIMESTAMP)
  @Excel(name = "入库日期" )
  private Date inStockDate;

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getOrderId() {
    return orderId;
  }

  public void setOrderId(String orderId) {
    this.orderId = orderId;
  }

  public String getTradesId() {
    return tradesId;
  }

  public void setTradesId(String tradesId) {
    this.tradesId = tradesId;
  }

  public String getSku_id() {
    return sku_id;
  }

  public void setSku_id(String sku_id) {
    this.sku_id = sku_id;
  }

  public String getSku_name() {
    return sku_name;
  }

  public void setSku_name(String sku_name) {
    this.sku_name = sku_name;
  }

  public String getUcode() {
    return ucode;
  }

  public void setUcode(String ucode) {
    this.ucode = ucode;
  }

  public String getInOrderNo() {
    return inOrderNo;
  }

  public void setInOrderNo(String inOrderNo) {
    this.inOrderNo = inOrderNo;
  }

  public String getSupplierName() {
    return supplierName;
  }

  public void setSupplierName(String supplierName) {
    this.supplierName = supplierName;
  }

  public Double getCostPrice() {
    return costPrice;
  }

  public void setCostPrice(Double costPrice) {
    this.costPrice = costPrice;
  }

  public Date getOutStockDate() {
    return outStockDate;
  }

  public void setOutStockDate(Date outStockDate) {
    this.outStockDate = outStockDate;
  }

  public Date getInStockDate() {
    return inStockDate;
  }

  public void setInStockDate(Date inStockDate) {
    this.inStockDate = inStockDate;
  }

  public String getShopName() {
    return shopName;
  }

  public void setShopName(String shopName) {
    this.shopName = shopName;
  }

  public UniqueCodes() {
  }

  public UniqueCodes(UniqueCodes uniqueCodes,String tradesId) {
    if(StringUtils.isNotEmpty(tradesId)){
      this.tradesId = tradesId;
    }
    if(StringUtils.isNotEmpty(uniqueCodes.getSku_id())){
      this.sku_id = uniqueCodes.getSku_id();
    }
    if(StringUtils.isNotEmpty(uniqueCodes.getSku_name())){
      this.sku_name = uniqueCodes.getSku_name();
    }
    if(StringUtils.isNotEmpty(uniqueCodes.getUcode())){
      this.ucode = uniqueCodes.getUcode();
    }
    if(StringUtils.isNotEmpty(uniqueCodes.getInOrderNo())){
      this.inOrderNo = uniqueCodes.getInOrderNo();
    }
    if(StringUtils.isNotEmpty(uniqueCodes.getShopName())){
      this.shopName = uniqueCodes.getShopName();
    }
    if(StringUtils.isNotEmpty(uniqueCodes.getSupplierName())){
      this.supplierName = uniqueCodes.getSupplierName();
    }
    if(null != uniqueCodes.getCostPrice()){
      this.costPrice = uniqueCodes.getCostPrice();
    }
    if(null != uniqueCodes.getOutStockDate()){
      this.outStockDate = uniqueCodes.getOutStockDate();
    }
    if(null != uniqueCodes.getInStockDate()){
      this.inStockDate = uniqueCodes.getInStockDate();
    }
  }
}
